package com.example.test02.api;

import com.example.test02.util.HttpService;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Response;

public class user {
    //登录
    private static final String LOGIN_URL = "/user/login"; // 基础URL

    public interface LoginCallback {
        void onFailure(Call call, IOException e);
        void onResponse(Call call, Response response) throws IOException;
    }

    public static void login(String phone, String password, LoginCallback callback) {
        Map<String, String> params = new HashMap<>();
        params.put("phone", phone);
        params.put("password", password);

        HttpService.post(LOGIN_URL, params, (Callback) callback);
    }
}
